<template>
  <h3><span v-show="required" class="required">*</span>{{ title }}</h3>
  <div style="height: 15px">
    <div v-show="required && !validator" class="validator">
      此项为必填项，别偷懒哦，请选点啥或写点啥吧！
    </div>
  </div>
</template>
<script>
export default {
  props: {
    title: {
      type: String,
      required: true,
    },
    required: {
      type: Boolean,
      default: false,
    },
    validator: {
      type: Boolean,
      default: true,
    },
  },
};
</script>
<style lang="less">
.required {
  color: red;
}
.validator {
  font-size: 12px;
  color: red;
  animation: valid 2s infinite;
}
@keyframes valid {
  0% {
    opacity: 0;
  }
  25% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
  75% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
  }
}
</style>